<?php
/*
	应用购买记录
*/

defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$types=get_permission_types('id','all');
$tabs=array();
foreach($types as $row){
	$tabs[]=array('op'=>'list','query'=>'type='.$row['id'],'title'=>$row['title']);
}
if($_RQ['op']=='list'){
	//余额变更记录
	$params=array();
	$params['uniacid']=$_SESSION['uniacid'];
	$return['params']['type']=$params['type']=$type=intval($_RQ['type']);
	$pindex = max(1, intval($_RQ['page']));
	$psize = 20;
	$total='';
	$fields=array();
	$list=pdo_getslice('core_account_store_logs',$params,array($pindex,$psize),$total,$fields,'','id desc');
	if($list){
		foreach($list as &$item){
			$item['title']=pdo_getcolumn($types[$type]['table'],array('id'=>$item['pid']),'title');
		}
	}
	$return['list']=$list;
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$htmls=array(
		'type'=>'list',
		'tabs'=>$tabs,
		'list'=>array('data'=>'list','edit'=>false,'list'=>array(
			array('name'=>'title','title'=>'应用名称','type'=>'string'),
			array('name'=>'content','title'=>'应用单价','type'=>'string'),
			array('name'=>'num','title'=>'购买数量','type'=>'string'),
			array('name'=>'price','title'=>'购买费用','type'=>'string'),
			array('name'=>'createtime','title'=>'购买时间','type'=>'time'),
			array('name'=>'remark','title'=>'备注','type'=>'string'),
			
		)),
	);
	$return['htmls']=$htmls;
	exi($return);
}

